package org.changwang.BigDecimal;

import java.math.BigDecimal;

/**
 * @ClassName BigDecimalTest01
 * @Description BigDecimal 使用
 * @Author c.w
 * @Date 2025/5/20 11:15
 * @Version 1.0.0
 */
public class BigDecimalTest01 {
	public static void main(String[] args) {
		BigDecimal a = new BigDecimal(0.1);
		System.out.println(a);
		BigDecimal b = new BigDecimal("0.1");
		System.out.println(b);

		System.out.println(a.add(b));


		BigDecimal bigger = new BigDecimal("251.151");
		BigDecimal smaller = new BigDecimal("250.150");
		System.out.println(smaller.compareTo(bigger));

		BigDecimal n10 = new BigDecimal(10);
		BigDecimal n3 = new BigDecimal(3);
		System.out.println(n10.divide(n3));
	}
}